<#assign  path=request.contextPath>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <meta content="IE=7" http-equiv="X-UA-Compatible">
    <title>天气---温度---首页广告--欢迎页背景--遥控器设置</title>
    <link type="text/css" rel="stylesheet" href="${path}/statics/css/reset.css">
    <link type="text/css" rel="stylesheet" href="${path}/statics/css/zh-cn-system.css">
    <link type="text/css" rel="stylesheet" href="${path}/statics/css/table_form.css">
    <link media="screen" title="styles1" href="${path}/statics/css/style/zh-cn-styles1.css" type="text/css" rel="stylesheet">
    <link media="screen" title="styles2" href="${path}/statics/css/style/zh-cn-styles2.css" type="text/css"
            rel="alternate stylesheet">
    <link media="screen" title="styles3" href="${path}/statics/css/style/zh-cn-styles3.css" type="text/css"
            rel="alternate stylesheet">
    <link media="screen" title="styles4" href="${path}/statics/css/style/zh-cn-styles4.css" type="text/css"
            rel="alternate stylesheet">
    <link href="${path}/statics/css/tips.css" rel="stylesheet" type="text/css">
    <script src="${path}/statics/js/jquery-1.8.3.min.js" type="text/javascript" language="javascript"></script>
    <script src="${path}/statics/js/art/jquery.artDialog.js?skin=blue" type="text/javascript" language="javascript"></script>
    <script src="${path}/statics/js/art/iframeTools.js" type="text/javascript" language="javascript"></script>
    <script src="${path}/statics/js/admin_common.js" type="text/javascript" language="javascript"></script>
    <script src="${path}/statics/js/styleswitch.js" type="text/javascript" language="javascript"></script>
    <script src="${path}/statics/js/commons/common.js" type="text/javascript" language="javascript"></script>
    <script src="${path}/statics/js/commons/commonCheck.js" type="text/javascript" language="javascript"></script>
    <script src="${path}/statics/js/commons/Base64.js" type="text/javascript" language="javascript"></script>
    <script type="text/javascript">
        $(function ()
        {
            calljson("", "${path}/curd/getimg", function (data)
            {
                $("#imgdivs").html(data["imgdivs"]);
                $("#img_id").html(data["img_id"]);
            });

        });


        // 删除文件，重置页面
        function delfile(objid, little_big)
        {
            $.getJSON("${path}/file/del", "objid=" + objid + "", function (data)
            {
                $("#" + little_big).html("<a  href=\"javascript:;\" onclick=\"javascript:flashupload(\'" + little_big + "\');\">上传</a>");
            });
        }


        /**
         *
         * @param rsdiv  某个div的id，这个div用于承接返回过来的数据
         */
        function flashupload(rsdiv)
        {

            //文件类型不用再转换，直接使用
            //   onesize=2&count=1&*.jpg;*.jpeg;*.gif;
            var args = "rsdiv=" + rsdiv + "&onesize=1&count=1&filetypes=*.jpg;*.png;*.bpm;*.gif";
            art.dialog.open('${path}/upload/upload_dialog/?' + args,
                    {
                        lock: true,
                        background: '#F2F2F2', // 背景色
                        opacity: 0.4,    // 透明度
                        width: '500px',
                        height: '420px',
                        drag: true,
                        title: '上传',
                        resize: false,
                        fixed: true
                    }
            );
        }


        function add_line(this_)
        {
            //最后一个元素的序号
            var index_ = $("#imgdivs div:last").attr("index_");
            index_ = parseInt(index_) + 1;

            var str = "<tr>\n" +
                    "                <th width=\"100\">第" + index_ + "张图片</th>\n" +
                    "                <td width=\"150\">\n" +
                    "                    <div index_=\"" + index_ + "\" id=\"img" + index_ + "\">\n" +
                    "                        <a onclick=\"javascript:flashupload('img" + index_ + "');\" href=\"javascript:;\">上传</a>\n" +
                    "                    </div>\n" +
                    "                </td>\n" +
                    "               <td><a href=\"javascript:add_line(" + index_ + ")\">+</a>&nbsp;&nbsp;<a href=\"javascript:remove_line(" + index_ + ")\">-</a></td> \n" +
                    "</tr>";
            $("#imgdivs").append(str);
        }

        function remove_line(index_)
        {
            $("#imgdivs").find("div[index_='" + index_ + "']").parent().parent().remove();
        }


        function save()
        {
            if (1 == 1)
            {
                alert("正在测试");
                return;
            }
            var img_ids = "";
            var arg = $("div[id*='img'] a[objid]").each(function (i, em)
            {
                var objid = $(this).attr("objid");
                if ($("div[id*='img'] a[objid]").size() == (i + 1))
                {
                    img_ids = img_ids + objid;
                }
                else
                {
                    img_ids = img_ids + objid + ",";
                }
            });
            if (isBlank(img_ids))
            {
                show_msgbox("", "没有上传首页背景图");
                return;
            }

            var img_id = $("#img_id>a[objid]").attr("objid");
            if (isBlank(img_id))
            {
                show_msgbox("", "没有上传遥控器说明图片");
                return;
            }

            show_msgbox("", "保存成功");
            refersh_window();
            return;///下面的代码暂时不执行了，先执行一下下

            var args = "etag=" + new Date() + "&citycode=" + citycode + "&weather=" + weather + "&diwen=" + diwen + "&gaowen=" + gaowen + "&playurl=" + playurl + "&welcometxt=" + welcometxt + "&img_ids=" + img_ids + "&show_=" + show_ + "&time_=" + time_ + "&img_id=" + img_id + ""
            calljson(args, "/common/save_other", function (data)
            {
                show_msgbox("", "保存成功");
                refersh_window();
            });


        }


        /**
         *
         * @param rsdiv  某个div的id，这个div用于承接返回过来的数据
         */
        function flashupload2(rsdiv)
        {

            //文件类型不用再转换，直接使用
            //   onesize=2&count=1&*.jpg;*.jpeg;*.gif;
            var args = "rsdiv=" + rsdiv + "&onesize=1&count=1&filetypes=*.jpg;*.png;*.bpm;*.gif";
            art.dialog.open('${path}/upload/upload_dialog/?' + args,
                    {
                        lock: true,
                        background: '#F2F2F2', // 背景色
                        opacity: 0.4,    // 透明度
                        width: '500px',
                        height: '420px',
                        drag: true,
                        title: '上传',
                        resize: false,
                        fixed: true
                    }
            );
        }


    </script>
</head>
<body>
<div class="subnav  line-x">
    <div class="content-menu ib-a blue">
        <div style="height: 30px;width: 200px;float: left">
            <a href="/test/test/upload/show/"><em>刷新</em></a>|
            <input type="button" onclick="save()" class="button" value="保存" id="btn_save">
        </div>
        <div class="msgbox" style="float: left">
            <span class="errmsg"></span><span class="errclose">×</span>
        </div>
    </div>
    <div class="clear"></div>
</div>

<style type="text/css">
    html
    {
        _overflow-y: scroll
    }
</style>

<div style="margin-top: 10px;"></div>
<div class="pad-6">
    <fieldset style="width: 40%;height: 250px;float: left;margin: 15px;">
        <legend>首页配置</legend>
        <table class="table_form" style="overflow-y: scroll;">
            <tr>
                <td>欢迎语</td>
                <td>
                    <textarea rows="3" cols="50" id="welcometxt">尊敬的$custome:
                        欢迎下榻北京国际温泉酒店，我们将竭诚为您服务【需要针对不同的房间号配置不同的姓名】</textarea>
                </td>
            </tr>

            <tr>
                <td style="vertical-align: top">
                    <div class="pad-6">背景图</div>
                </td>
                <td>
                    <div style=" height: 110px;overflow-y: auto;vertical-align: middle;">

                        <table width=100% id="imgdivs" class="table_form contentWrap">

                            <tr>
                                <th width="100">第1个</th>
                                <td width="150">
                                    <div id="img1" index_="1">
                                        <a href="javascript:;" onclick="javascript:flashupload('img1');">上传</a>
                                    </div>
                                </td>
                                <td><a href="javascript:add_line(1)">+</a></td>
                            </tr>

                        </table>

                    </div>
                </td>
            </tr>
        </table>
    </fieldset>


    <fieldset style="width: 40%;height: 250px;float: left;margin: 15px;">
        <legend>遥控器使用说明</legend>
        <table class="table_form">
            <tr>
                <td>是否显示</td>
                <td><input id="show_" type="checkbox"></td>
            </tr>

            <tr>
                <td>自动跳过</td>
                <td><input size="3" id="time_" type="text"> 秒后</td>
            </tr>

            <tr>
                <td>图片</td>
                <td>
                    <div id="img_id">
                        <a onclick="javascript:flashupload('img_id');" href="javascript:;">上传</a>
                    </div>
                </td>
            </tr>


        </table>


    </fieldset>


</div>


</body>
</html>